{{- $version := "1.12.3" }}
image: {{ $.ModuleName }}/{{ $.ImageName }}
fromImage: common/distroless
import:
- artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $version | replace "." "-" }}
  add: /build/cert-manager/_bin/server/controller-linux-amd64
  to: /bin/cert-manager-controller
  before: setup
docker:
  ENTRYPOINT: ["/bin/cert-manager-controller"]
---
artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $version | replace "." "-" }}
from: {{ $.Images.BASE_GOLANG_19_BULLSEYE }}
git:
- add: /{{ $.ModulePath }}modules/101-{{ $.ModuleName }}/images/{{ $.ImageName }}/patches
  to: /patches
  stageDependencies:
    install:
    - '**/*'
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  beforeInstall:
  - apt update
  - apt install patch jq -y
  install:
  - mkdir /build
  - cd /build
  - git clone -b "v{{ $version }}" --single-branch --depth=1 {{ $.SOURCE_REPO }}/jetstack/cert-manager.git
  - cd /build/cert-manager
  - test -d /patches && for patchfile in /patches/*.patch ; do patch -p1 < ${patchfile}; done
  - export RELEASE_VERSION="v{{ $version }}-flant"
  - GOPROXY={{ $.GOPROXY }} make CTR=jq _bin/server/controller-linux-amd64 _bin/server/acmesolver-linux-amd64 _bin/server/webhook-linux-amd64 _bin/server/cainjector-linux-amd64
